<!doctype html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>后台登录-X-admin2.2</title>

    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/login.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">电力巡检系统</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form" th:action="@{/user/login}">
        <input name="username" placeholder="用户名" type="text" lay-verify="required|username" class="layui-input">
        <hr class="hr15">
        <input name="password" lay-verify="required|pass" placeholder="密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
    </form>
</div>
<script>
    $(function () {
        layui.use('form', function () {
            var form = layui.form;

            if("[[${msg}]]"){
            layer.msg('[[${msg}]]', function(){
              //关闭后的操作
              });
            }
            form.verify({
                username: function(value){
                    if(value.length < 6 || value.length>20){
                        return '用户名是必须6到20位字符';
                    }
                }
                //我们既支持上述函数式的方式，也支持下述数组的形式
                //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
                , pass: [
                    /^[\S]{6,20}$/
                    , '密码是必须6到20位字符'
                ]
            });


            //监听提交
            form.on('submit(login)', function (data) {

                // layer.msg(JSON.stringify(data.field), function () {
                //     alert(data.field);
                //     location.href = 'index.html'
                // });
                return true;
            });
        });


    })
</script>
<!-- 底部结束 -->
</body>
<script>
    //百度统计可去掉

</script>
</html>